<?php

/**
 * PlayerHistory filter form base class.
 *
 * @package    raidpoints
 * @subpackage filter
 * @author     David Driscoll
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePlayerHistoryFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'raidid'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Raid'), 'add_empty' => true)),
      'playerid'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Player'), 'add_empty' => true)),
      'points'     => new sfWidgetFormFilterInput(),
      'lifetime'   => new sfWidgetFormFilterInput(),
      'decay'      => new sfWidgetFormFilterInput(),
      'normalize'  => new sfWidgetFormFilterInput(),
      'oldentries' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'raidid'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Raid'), 'column' => 'id')),
      'playerid'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Player'), 'column' => 'id')),
      'points'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'lifetime'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'decay'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'normalize'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'oldentries' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('player_history_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PlayerHistory';
  }

  public function getFields()
  {
    return array(
      'id'         => 'Number',
      'raidid'     => 'ForeignKey',
      'playerid'   => 'ForeignKey',
      'points'     => 'Number',
      'lifetime'   => 'Number',
      'decay'      => 'Number',
      'normalize'  => 'Number',
      'oldentries' => 'Number',
    );
  }
}
